home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekkan Dennou Club 145
/
Gekkan Dennou Club - 2000.6 Vol. 145 (Japan).7z
/
Gekkan Dennou Club - 2000.6 Vol. 145 (Japan) (Track 1).bin
/
games
/
spassion
/
source.lzh
/
SOURCE
/
SPASSION.C
< prev
next >
Wrap
Text File
|
2000-03-31
|
22KB
|
866 lines
#include <stdio.h>
#include <stdlib.h>
#include <doslib.h>
#include <iocslib.h>
#include <apic.h>
#include <XSP2lib.H>
#include <PCM8Afnc.H>
#define GLOBAL_DEFINE /* グローバル変数を確保する */
#include "SPASSION.H"
#include "PLAYER.H"
#include "SHOT.H"
#include "ENEMY.H"
#include "ESHOT.H"
#include "EFFECT.H"
#include "ENTRY.H"
#include "BG.H"
#include "SOUND.H"
#include "SUB.H"
#define MAX_LEVEL 2
#define MAX_LEFT 9
void Disp( void );
static char last_stage=0,stage_select=0;
static short ret_title_flag=0,init_title_flag=1;
static short pause_flag=0; /* =!0 なら一時停止中 */
static short left1=3,left2=3; /* デフォルトの残機数 */
static short cur_x=0,cur_y=0;
short cur0_bg[]={0x00,0x01,0x02,0x03,0x04,0x04,0x03,0x02,0x01,0x00,-1};
short cur1_bg[]={0x05,0x06,0x07,0x08,0x09,0x09,0x08,0x07,0x06,0x05,0x02,-1};
enum {
CONFIG_LEVEL = 0,
CONFIG_LEFT_1P,
/* CONFIG_LEFT_2P,*/
CONFIG_BT_SWAP_1P,
DUM1,
/* CONFIG_BT_SWAP_2P,*/
/* DUM2,*/
CONFIG_MUSIC,
CONFIG_SE,
CONFIG_XSP,
CONFIG_DISP,
CONFIG_EXIT
};
enum { START = 0,CONTINUE,CONFIG,END };
static short end_stage_work=0;
static short game_over_work=0;
void VdispRoutine( void )
{
static short x1=0-5*16,x2=255,con=15,count=0;
switch (game_state){
case END_STAGE:
if(pause_flag)break;
switch ( end_stage_work ){
case 0:
x1=0-5*16;x2=255;
player[0].vx=0;player[0].vy=0;
player[1].vx=0;player[1].vy=0;
player[0].state=PLAYER_LAST;
player[1].state=PLAYER_LAST;
player[0].dead_count=2; /*PLAYER_LASTでの動作カウンタ*/
player[1].dead_count=2; /*PLAYER_LASTでの動作カウンタ*/
end_stage_work++;
case 1: /*文字列入場*/
PutBGStr( x1+= 8, 16*7, "STAGE", INFO_MOJI);
if( x1 > 128-5*16/2 ){
x1=128-5*16/2;
end_stage_work++;
}
break;
case 2: /*文字列入場*/
PutBGStr( x1 , 16*7, "STAGE", INFO_MOJI);
PutBGStr( x2-= 8, 16*9, "CLEAR!", INFO_MOJI);
if( x2 < 128-5*16/2 ){
x2=128-5*16/2;
end_stage_work++;
}
break;
case 3: /*プレイヤーが画面から出るのを待つ*/
PutBGStr( x1, 16*7, "STAGE", INFO_MOJI);
PutBGStr( x2, 16*9, "CLEAR!", INFO_MOJI);
if( player[0].state==PLAYER_WAIT && (count++> 60*1) &&
(( play_mode == MODE_2P && player[1].state==PLAYER_WAIT )
||play_mode==MODE_1P)
){
count=0;
end_stage_work++;
}
break;
case 4: /*文字列退場*/
PutBGStr( x1+= 8, 16*7, "STAGE", INFO_MOJI);
PutBGStr( x2-= 8, 16*9, "CLEAR!", INFO_MOJI);
if( x1>255 && x2<-16*6 )
end_stage_work++;
break;
case 5:
CONTRAST(con--);
if( CONTRAST(-1) == 0 )
end_stage_work++;
break;
case 6:
if( count++> 30*1 ){
count=0;
player[0].state=PLAYER_APPEAR;
player[1].state=PLAYER_APPEAR;
game_state=IN_GAME;
end_stage_work=0;
entry_counter_stop = 0; /* エントリーカウンター停止解除 */
x1=0;x2=255;
con=15;
if( ++stage>=STAGES ){
stage=STAGES-1;
game_state=ENDING;
game_over_state = GAME_COMPLETE;
last_stage=0;
}
xsp_vsyncint_off();
}
}
break;
case IN_GAME_OVER:
if(pause_flag)break;
switch ( game_over_work ){
case 0:
PlayBGM( MUSIC_GAME_OVER );
x1=0-5*16;x2=255;
game_over_work++;
case 1: /*文字列入場*/
PutBGStr( x1+= 8, 16*7, "GAME", INFO_MOJI);
if( x1 > 128-4*16/2 ){
x1=128-4*16/2;
game_over_work++;
}
break;
case 2: /*文字列入場*/
PutBGStr( x1 , 16*7, "GAME", INFO_MOJI);
PutBGStr( x2-= 8, 16*9, "OVER!", INFO_MOJI);
if( x2 < 128-4*16/2 ){
x2=128-4*16/2;
game_over_work++;
}
break;
case 3: /*ちょっと待つ*/
PutBGStr( x1, 16*7, "GAME", INFO_MOJI);
PutBGStr( x2, 16*9, "OVER!", INFO_MOJI);
if( count++> 60*1 ){
game_over_work++;
count=0;
}
break;
case 4: /*文字列退場*/
PutBGStr( x1+= 8, 16*7, "GAME", INFO_MOJI);
PutBGStr( x2-= 8, 16*9, "OVER!", INFO_MOJI);
if( x1>255 && x2<-16*5 )
game_over_work++;
break;
case 5: /*ちょっと待つ*/
if( count++> 60*1 ){
game_over_work++;
count=0;
}
break;
case 6: /* 画面フェードアウト */
CONTRAST(con--);
if( CONTRAST(-1) == 0 )
game_over_work++;
break;
case 7:
if( count++> 30*1 ){
count=0;
game_state=IN_TITLE;
game_over_work=0;
game_over_state=GAME_OVER;
con=15;
x1=0;x2=255;
CONTRAST(15);
xsp_vsyncint_off();
}
}
}
}
/*ステージ開始時の処理*/
void InitStage( void )
{
unsigned short *pal=(unsigned short *)0xE82220;
short i;
char *stage_pic[STAGES*2]={
"PIC/STAGE1_0.PIC","PIC/STAGE1_1.PIC",
"PIC/STAGE2.PIC", "PIC/STAGE2.PIC",
"PIC/STAGE3_0.PIC","PIC/STAGE3_1.PIC",
"PIC/STAGE4_0.PIC","PIC/STAGE4_1.PIC",
};
char *stage_map[STAGES]={
"BG/STAGE01.MAP",
"BG/STAGE02.MAP",
"BG/STAGE03.MAP",
"BG/STAGE04.MAP",
};
last_stage=stage;
BGCTRLST(1, 1, 0); /* BG1表示OFF */
VPAGE(0); /* 表示を消す */
HOME( 0, 0 ,0 );
HOME( 1, 0 ,0 );
APAGE(1);apic_load(stage_pic[stage*2] ,0,0);
APAGE(0);apic_load(stage_pic[stage*2+1],0,0);
VPAGE(3); /* 表示 */
LoadMapFile(stage_map[stage], &bg_map[stage][0], sizeof (short), 32 * 32 * 6);
for(i=0;i<16;i++)
*(pal++)=bg_pal[stage][i];
for(i=0;i<256;i++)
SP_DEFCG(i, 0, &bg_sp[stage][i*32]);
SetBG(0,0);
BGCTRLST(1, 1, 1); /* BG1表示ON */
gr1_x=0; gr1_y=0; gr1_vx=32768;gr1_vy=0;
gr2_x=0; gr2_y=0; gr2_vx=21845;gr2_vy=0;
map_x=0;map_y=0;map_vx=DOT_RATE/4;map_vy=0;
game_state=IN_GAME;
CONTRAST(15);
InitShot();
InitEnemy();
InitEShot();
InitEntry();
InitEffect();
while( CONTRAST(-1) != 15 );
}
void Game( void )
{
short x1=16*5+8,x2=16*5-8,i=15,gx1=0,gx2=512;
void Ending( void );
short Pause( void );
FadeOut( 48 );
InitPlayer( &player[0] );player[0].num = 0; /* プレイヤーの番号 */
InitPlayer( &player[1] );player[1].num = 1; /* プレイヤーの番号 */
ret_title_flag=0;
player[0].left=left1-1;
player[1].left=left2-1;
while( gx1<256 ){
PutBGStr( x1 , 16* 9, "START", INFO_MOJI );
PutBGStr( x2 , 16*10, "CONTNUE", INFO_MOJI );
PutBGStr( x1-=10, 16*11, "CONFIG", INFO_MOJI );
PutBGStr( x2+=10, 16*12, "END", INFO_MOJI );
xsp_vsync( 1 );
HOME( 2, gx1+=10, 0 );
HOME( 1, gx2-=10, 0 );
xsp_out();
}
InitShot();
InitEnemy();
InitEShot();
InitEntry();
InitEffect();
i=15;
while( CONTRAST(-1) != 0 ){
xsp_vsync( 1 );
CONTRAST(--i);
}
while(game_over_state == GAME_PLAY){
short x,y;
MoveEntry(); /* 敵出現、イベント発生 */
MovePlayer( &player[0] ); /* 1P自機移動 */
if( play_mode == MODE_2P )
MovePlayer( &player[1] ); /* 2P自機移動 */
MoveShot(); /* 自弾移動 */
MoveEnemy(); /* 敵機移動 */
MoveEShot(); /* 敵弾移動 */
MoveEffect(); /* エフェクト処理 */
map_x+=map_vx;
{
int mx;
if( map_x > (mx=((32*5*8)<<16)) )
map_x = mx;
}
bg_x=map_x>>16;
bg_y=map_y>>16;
x=bg_x/8;
y=bg_y/8;
for(i=31;i>=0;i--)
BGTEXTST(1,(x+32)&63,(y+i)&63,GetBG(x+32,y+i));
bg_x&=0x1FF;bg_y&=0x1FF;
/* BGSCRLST( 1,bg_x&0x1FF,bg_y&0x1FF );*/ /* vsyncを待たなくてもちらつかないようだけど、一応 */
/* ScrollBG();*/ /* BGスクロール */
/* ScrollBG();を使わないのは、今回右にしかスクロールしないから*/
gr1_x+=gr1_vx;gr1_y+=gr1_vy; /* 背景スクロール */
gr2_x+=gr2_vx;gr2_y+=gr2_vy;
if( BITSNS(0x00) & BIT(0x01) ){ /* ESCが押されたらPAUSE */
if( !Pause() ){
ret_title_flag=1;
break;
}
}else
Disp(); /* 表示 */
PlaySE(); /* 効果音 */
#if 0
/* C キーでテキスト消去(デバッグ用) */
if( BITSNS(0x05) & BIT(4) )
B_CLR_AL();
#endif
}
if(game_over_state == GAME_COMPLETE)
Ending();
}
void Config( void )
{
char joy=0,cur_y=0,cur_anim=0;
char key_flag=0,button_flag=0,kettei_flag=0,start_flag=1,end_flag=0,break_flag=0;
short x1=256+16,x2=-256+16,tx1=16*5,tx2=16*5;
short music=0,se=1;
while( tx2<256+16 ){
PutBGStr( tx1 , 16* 9, "START", INFO_MOJI );
PutBGStr( tx2 , 16*10, "CONTNUE", INFO_MOJI );
PutBGStr( tx1-=10, 16*11, "CONFIG", INFO_MOJI );
PutBGStr( tx2+=10, 16*12, "END", INFO_MOJI );
xsp_vsync( 1 );
xsp_out();
}
FadeOut( 48 );
PlayBGM( MUSIC_CONFIG );
while(1){
if( !kettei_flag ){
joy=GetKey( 0,player[0].button_swap );
if( !key_flag ){
switch (joy){
case 1: /* 上 */
SetSE(SE_PIN);
cur_y--;
if( cur_y == DUM1 )cur_y=CONFIG_BT_SWAP_1P;
/* if( cur_y == DUM2 )cur_y=CONFIG_BT_SWAP_2P;*/
if( cur_y < CONFIG_LEVEL )cur_y=CONFIG_EXIT;
break;
case 2: /* 下 */
SetSE(SE_PIN);
cur_y++;
/* if( cur_y == DUM1 )cur_y=CONFIG_BT_SWAP_2P;*/
if( cur_y == DUM1 )cur_y=CONFIG_MUSIC;
/* if( cur_y == DUM2 )cur_y=CONFIG_MUSIC;*/
if( cur_y > CONFIG_EXIT )cur_y=CONFIG_LEVEL;
}
}
switch (cur_y){
case CONFIG_LEVEL: /* 難易度 */
if( joy == KEY_RIGHT && !key_flag ){
level++;
if( level > MAX_LEVEL )level=0;
}
if( joy == KEY_LEFT && !key_flag ){
level--;
if( level < 0 )level=MAX_LEVEL;
}
break;
case CONFIG_LEFT_1P: /* 1P残機 */
if( joy == KEY_RIGHT && !key_flag ){
left1++;
if( left1 > MAX_LEFT )left1=1;
}
if( joy == KEY_LEFT && !key_flag ){
left1--;
if( left1 < 1 )left1=MAX_LEFT;
}
break;
#if 0
case CONFIG_LEFT_2P: /* 2P残機 */
if( joy == KEY_RIGHT && !key_flag ){
left2++;
if( left2 > MAX_LEFT )left2=1;
}
if( joy == KEY_LEFT && !key_flag ){
left2--;
if( left2 < 1 )left2=MAX_LEFT;
}
break;
#endif
case CONFIG_BT_SWAP_1P: /* 1Pボタン入れ換え */
if( (joy == KEY_RIGHT||joy == KEY_LEFT) && !key_flag ){
if( player[0].button_swap == OFF )player[0].button_swap=ON;
else player[0].button_swap=OFF;
}
break;
#if 0
case CONFIG_BT_SWAP_2P: /* 2Pボタン入れ換え */
if( (joy == KEY_RIGHT||joy == KEY_LEFT) && !key_flag ){
if( player[1].button_swap == OFF )player[1].button_swap=ON;
else player[1].button_swap=OFF;
}
break;
#endif
case CONFIG_MUSIC: /* 音楽 */
if( joy == KEY_RIGHT && !key_flag ){
music++;
if( music > MAX_MUSIC-1 )music=0;
}
if( joy == KEY_LEFT && !key_flag ){
music--;
if( music < 0 )music=MAX_MUSIC-1;
}
if( joy & B_BUTTON && !button_flag ){
/* void ChangeZPD( short num );
if( music == MAX_MUSIC-1 )
ChangeZPD( 1 );
*/
PlayBGM(music);
/* if( music == MAX_MUSIC-1 )
ChangeZPD( 0 );
*/
}
break;
case CONFIG_SE: /* 効果音 */
if( joy == KEY_RIGHT && !key_flag ){
se++;
if( se > MAX_SE-1-1 )se=1;
}
if( joy == KEY_LEFT && !key_flag ){
se--;
if( se < 1 )se=MAX_SE-1-1;
}
if( joy & B_BUTTON && !button_flag ){
SetSE(se);
}
break;
case CONFIG_XSP: /* XSPの表示レベル */
if( joy == KEY_RIGHT && !key_flag ){
xsp_mode_num++;
if( xsp_mode_num > 3 )xsp_mode_num=1;
}
if( joy == KEY_LEFT && !key_flag ){
xsp_mode_num--;
if( xsp_mode_num < 1 )xsp_mode_num=3;
}
break;
case CONFIG_DISP: /* 表示負荷レベル */
if( (joy == KEY_RIGHT || joy == KEY_LEFT) && !key_flag ){
if( disp_level == DISP_LEVEL_HIGH )disp_level=DISP_LEVEL_MID;
else if( disp_level == DISP_LEVEL_MID )disp_level=DISP_LEVEL_HIGH;
}
break;
case CONFIG_EXIT: /* 出口 */
if( joy & B_BUTTON && !button_flag ){
SetSE(SE_PON);
cur_anim=0;
kettei_flag=1;
/* break;*/
}
break;
}
}
if( joy & 0x0F )key_flag=1;else key_flag=0;
if( joy & 0xF0 )button_flag=1;else button_flag=0;
/*表示*/
/* カーソル */
if( kettei_flag ){
if(cur1_bg[(++cur_anim)/6]==-1){
cur_anim--;
end_flag=1;
}else
xobj_set( (2+cur_x)*16, (5+cur_y)*16+8, cur1_bg[cur_anim/6], 0x023F );
}else{
if(cur0_bg[(++cur_anim)/6]==-1)cur_anim=0;
xobj_set( (2+cur_x)*16, (5+cur_y)*16+8, cur0_bg[cur_anim/6], 0x023F );
}
/* 文字列 */
PutBGStr( x1, 16* 4, "LEVEL", INFO_MOJI ); /* LEVEL */
switch ( level ){
case 0:
PutBGStr( 16* 6+x1, 16* 4, "EASY", INFO_MOJI );
break;
case 1:
PutBGStr( 16* 6+x1, 16* 4, "NOMAL", INFO_MOJI );
break;
case 2:
PutBGStr( 16* 6+x1, 16* 4, "HARD", INFO_MOJI );
break;
}
PutBGStr( x2, 16* 5, "LEFT", INFO_MOJI );PutBGVal0(16* 6+x2, 16* 5, left1, 1, INFO_MOJI ); /* 1P_LEFT */
/* PutBGStr( x2, 16* 5, "1P_LEFT", INFO_MOJI );PutBGVal0(16* 8+x2, 16* 5, left1, 1, INFO_MOJI );*/ /* 1P_LEFT */
/* PutBGStr( x1, 16* 6, "2P_LEFT", INFO_MOJI );PutBGVal0(16* 8+x1, 16* 6, left2, 1, INFO_MOJI );*/ /* 2P_LEFT */
/* 1P BUTON */
/* PutBGStr( x2, 16* 7, "1P", INFO_MOJI );PutBGStr( x1, 16* 8, "BUTTON", INFO_MOJI );*/
PutBGStr( x1, 16* 6, "BUTTON", INFO_MOJI );
if( !player[0].button_swap ){
PutBGStr( 16* 6+x2, 16* 6, "A:OPTION", INFO_MOJI );
PutBGStr( 16* 6+x1, 16* 7, "B:SHOT", INFO_MOJI );
}else{
PutBGStr( 16* 6+x2, 16* 6, "A:SHOT", INFO_MOJI );
PutBGStr( 16* 6+x1, 16* 7, "B:OPTION", INFO_MOJI );
}
/* 2P BUTON */
/* PutBGStr( x2, 16* 9, "2P", INFO_MOJI );PutBGStr( x1, 16*10, "BUTTON", INFO_MOJI );
if( !player[1].button_swap ){
PutBGStr( 16* 6+x2, 16* 9, "A:OPTION", INFO_MOJI );
PutBGStr( 16* 6+x1, 16*10, "B:SHOT", INFO_MOJI );
}else{
PutBGStr( 16* 6+x2, 16* 9, "A:SHOT", INFO_MOJI );
PutBGStr( 16* 6+x1, 16*10, "B:OPTION", INFO_MOJI );
}
*/
PutBGStr( x2, 16* 8, "MUSIC", INFO_MOJI );PutBGVal0(16* 6+x2, 16* 8, music+1, 2, INFO_MOJI ); /* MUSIC */
PutBGStr( x1, 16* 9, "SE", INFO_MOJI );PutBGVal0(16* 6+x1, 16* 9, se, 2, INFO_MOJI ); /* SE */
/* XSP_MODE */
PutBGStr( x2, 16*10, "XSP", INFO_MOJI );
switch ( xsp_mode_num ){
case 1:
PutBGStr( 16* 6+x1, 16*10, "Low", INFO_MOJI );
break;
case 2:
PutBGStr( 16* 6+x1, 16*10, "Mid", INFO_MOJI );
break;
case 3:
PutBGStr( 16* 6+x1, 16*10, "High", INFO_MOJI );
break;
}
/* DISP_MODE */
PutBGStr( x2, 16*11, "DISP", INFO_MOJI );
switch ( disp_level ){
case DISP_LEVEL_MID:
PutBGStr( 16* 6+x1, 16*11, "Mid", INFO_MOJI );
break;
case DISP_LEVEL_HIGH:
PutBGStr( 16* 6+x1, 16*11, "High", INFO_MOJI );
break;
}
PutBGStr( x2, 16*12, "EXIT", INFO_MOJI ); /* EXIT */
xsp_vsync( 1 );
xsp_out();
PlaySE(); /* 効果音 */
if( start_flag ){
if( x1>16*2 ){
x1-=10;x2+=10;
}else{
x1=x2=16*2;
start_flag=0;
}
}
if( end_flag ){
if( x2<256+32+16 ){
x1-=10;x2+=10;
}else{
init_title_flag=0;
break_flag=1;
}
}
if( break_flag )
break;
while( BITSNS(0x00) & BIT(0x01) ); /* ESCが離されるまで待つ */
}
xsp_mode( xsp_mode_num );
}
static void InitTitle( void )
{
short gx1=256,gx2=256,x1=5*16+256,x2=5*16-256;
if( init_title_flag ){
if( init_title_flag > 1 ){
CRTMOD( 10 ); /* 256*256dot 256色 グラフィックプレーン1枚 31kHz */
G_CLR_ON();
MS_CUROF(); /* マウスカーソルを消す */
SKEY_MOD(0,0,0);
*(unsigned short *) 0xe82500 = 0b01001001001110; /* 優先順位 TX>SP>GR */
}
xsp_out(); /* 初期化 */
SP_ON(); /* スプライト表示をON */
B_CLR_AL(); /* テキスト消去(レーザーなどを消す) */
BGCTRLST(1, 1, 0); /* BG1表示OFF */
/* グラフィック表示 */
VPAGE(0);
APAGE(0);apic_load("PIC/TITLE1.PIC",0,0);
APAGE(1);apic_load("PIC/TITLE2.PIC",0,0);
HOME( 2, gx1, 0 );
HOME( 1, gx2, 0 );
VPAGE(2);
VPAGE(3);
}
PlayBGM( MUSIC_TITLE ); /* 音楽 */
SetSE(SE_NON); /* 効果音初期化 */
for(;x1>=16*5;x1-=8,x2+=8,gx1+=8,gx2-=8){
PutBGStr( x1, 16* 9, "START", INFO_MOJI );
PutBGStr( x2, 16*10, "CONTNUE", INFO_MOJI );
PutBGStr( x1, 16*11, "CONFIG", INFO_MOJI );
PutBGStr( x2, 16*12, "END", INFO_MOJI );
xsp_vsync( 1 );
if( init_title_flag ){
HOME( 2, gx1, 0 );
HOME( 1, gx2, 0 );
}
xsp_out();
}
HOME( 2, 0, 0 );
HOME( 1, 0, 0 );
cur_x=0;cur_y=0;
}
static short Title( void )
{
void Opening( void );
void InitMapData( void );
void game_end( void );
short count=0;
char joy,cur_anim,key_flag,kettei_flag;
InitTitle();
init_title_flag=1;
game_state=IN_TITLE;
cur_x=0;cur_y=0;cur_anim=0;key_flag=1;kettei_flag=0;
do{
joy=GetKey( 0,player[0].button_swap );
if( joy ){
if( !key_flag && !kettei_flag ){
switch (joy){
case 1: /* 上 */
SetSE(SE_PIN);
cur_y--;
if( cur_y < 0 )cur_y=3;
break;
case 2: /* 下 */
SetSE(SE_PIN);
cur_y++;
if( cur_y > 3 )cur_y=0;
}
if( joy & B_BUTTON ){ /* 決定 */
if( BITSNS(0x00) & BIT(0x03) )stage_select = 1;
if( BITSNS(0x00) & BIT(0x04) )stage_select = 2;
if( BITSNS(0x00) & BIT(0x05) )stage_select = 3;
SetSE(SE_PON);
kettei_flag=1;
cur_anim=0;
}
}
key_flag=1;
count=0;
}else
key_flag=0;
/* 一定時間操作が無いときはオープニング */
if( count++ > 60*5 ){
short con=15;
FadeOut( 96 );
while( CONTRAST(-1) != 0 ){
if(cur0_bg[(++cur_anim)/6]==-1)cur_anim=0;
/* xobj_set( (5+cur_x)*16, (10+cur_y)*16+8, cur0_bg[cur_anim/6], 0x023F );*/
xsp_vsync( 4 );
CONTRAST(--con);
/* xsp_out();*/
}
xsp_out(); /* 初期化 */
Opening();
init_title_flag=2;
InitTitle();
count=0;
}
if( kettei_flag ){
if(cur1_bg[(++cur_anim)/6]==-1)break;
xobj_set( (5+cur_x)*16, (10+cur_y)*16+8, cur1_bg[cur_anim/6], 0x023F );
}else{
if(cur0_bg[(++cur_anim)/6]==-1)cur_anim=0;
xobj_set( (5+cur_x)*16, (10+cur_y)*16+8, cur0_bg[cur_anim/6], 0x023F );
}
PutBGStr( 16*5, 16* 9, "START", INFO_MOJI );
PutBGStr( 16*5, 16*10, "CONTNUE", INFO_MOJI );
PutBGStr( 16*5, 16*11, "CONFIG", INFO_MOJI );
PutBGStr( 16*5, 16*12, "END", INFO_MOJI );
xsp_vsync( 1 );
xsp_out();
PlaySE(); /* 効果音 */
}while( kettei_flag!=2 );
return cur_y;
}
static void Usage( void )
{
printf("横スクロールシューティング・ShootingPassion ver1.00\n"
"\t\t\t\t佐藤幸治 2000/3/31\n"
"使い方: SPassion [option]\n"
"[option]\n"
"-X数値 : xsp_mode (数値 = 1~3, デフォルト = 2)\n"
"-D数値 : 表示負荷 (数値 = 1~2, デフォルト = 2)\n"
"-P : PCMによる効果音を出さない\n"
"-S : ジョイスティックABボタン入れ換え\n"
);
}
void main(int ac, char *av[])
{
void game_end( void );
short i;
xsp_mode_num = 2;
disp_level = DISP_LEVEL_HIGH;
pcm_mode = 1; /* 効果音 */
player[0].button_swap = OFF;
player[1].button_swap = OFF;
for (i = 1; i < ac; i++) {
if( av[1][0] == '-' || av[1][0] == '/' ){
switch (*(av[i] + 1)) {
case 'x':
case 'X':
xsp_mode_num = atoi(av[i] + 2);
if( xsp_mode_num < 1 )xsp_mode_num=1;
if( xsp_mode_num > 3 )xsp_mode_num=3;
break;
case 'd':
case 'D':
disp_level = atoi(av[i] + 2);
if( disp_level < 1 )disp_level=1;
if( disp_level > 2 )disp_level=2;
break;
case 'p':
case 'P':
pcm_mode=0;
break;
case 's':
case 'S':
player[0].button_swap = ON;
break;
default:
Usage();
return;
}
}
}
game_state = !IN_TITLE;
Init();
error_level = ERROR_NON;
level = NOMAL;
game_state = IN_TITLE;
for(i=0;cur0_bg[i]!=-1;i++)
cur0_bg[i]+=obj_player;
for(i=0;cur1_bg[i]!=-1;i++)
cur1_bg[i]+=obj_player;
left[0].x =16+16;
left[0].y =8+16;
left[0].pt = obj_player+21;
left[0].info=0x023F;
left[1].x =232+16;
left[1].y =8+16;
left[1].pt = obj_player+22;
left[1].info=0x023F;
/* --------- メインル~プ --------- */
while(1){
stage_select=0;
switch ( Title() ){
case START: /* start */
stage = 0;
if( stage_select==1 || BITSNS(0x00) & BIT(0x03) )stage = 1;
if( stage_select==2 || BITSNS(0x00) & BIT(0x04) )stage = 2;
if( stage_select==3 || BITSNS(0x00) & BIT(0x05) )stage = 3;
player[0].pow_lev= 0;
player[1].pow_lev= 0;
Game();
break;
case CONTINUE: /* continue */
stage = last_stage;
Game();
break;
case CONFIG: /* config */
Config();
break;
case END: /* end */
game_end();
}
}
}
void game_end( void )
{
short x1=16*5+8,x2=16*5-8,gx1=0,gx2=512;
if( !error_level ){
if( game_state==IN_TITLE ){
while( gx1<256 ){
PutBGStr( x1 , 16* 9, "START", INFO_MOJI );
PutBGStr( x2 , 16*10, "CONTNUE", INFO_MOJI );
PutBGStr( x1-=10, 16*11, "CONFIG", INFO_MOJI );
PutBGStr( x2+=10, 16*12, "END", INFO_MOJI );
xsp_vsync( 1 );
HOME( 2, gx1+=10, 0 );
HOME( 1, gx2-=10, 0 );
xsp_out();
}
}
Stop();
xsp_vsyncint_off();
pcm8a_vsyncint_off();
xsp_off();
}
CRTMOD( 16 );
KFLUSHIO(0xFF); /* キーバッファをクリア */
if( error_message )printf("%s\n",error_message);
OS_CURON(); /* カーソルを表示する */
exit(0);
}
short Pause( void )
{
char joy,button=0;
pause_flag=1;
PutBGStr( 16*0, 16* 6, " P A U S E ", INFO_MOJI );
PutBGStr( 16*0, 16* 8, " Q: TITLE ", INFO_MOJI );
PutBGStr( 16*0, 16* 9, " X: QUIT ", INFO_MOJI );
Disp();
while( BITSNS(0x00) & BIT(0x01) ); /* ESCが離されるまで待つ */
while( GetKey( 0, player[0].button_swap )&0xF0 ); /* ボタンが離されるまで待つ */
while( GetKey( 1, player[1].button_swap )&0xF0 ); /* ボタンが離されるまで待つ */
while( 1 ){
joy=GetKey( 0, player[0].button_swap );
button=joy&0xF0;
if( button )break; /* ボタンが押されたら出る */
if( BITSNS(0x00) & BIT(0x01) ){ /* ESCが押されたら出る */
while( BITSNS(0x00) & BIT(0x01) );
break;
}
if( BITSNS(0x02) & BIT(0x01) ){ /* Q が押されたら出る */
FadeOut( 48 );
CONTRAST(15);
game_state=IN_TITLE;
end_stage_work=0;
game_over_work=0;
pause_flag=0;
B_CLR_AL(); /* テキスト消去(レーザーなどを消す) */
return 0;
}
if( BITSNS(0x05) & BIT(0x03) )game_end(); /* X が押されたら出る */
}
player[0].b_button_flag=1;
pause_flag=0;
return 1;
}